import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/login_info_entity.dart';

LoginInfoEntity $LoginInfoEntityFromJson(Map<String, dynamic> json) {
  final LoginInfoEntity loginInfoEntity = LoginInfoEntity();
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    loginInfoEntity.uid = uid;
  }
  final String? token = jsonConvert.convert<String>(json['token']);
  if (token != null) {
    loginInfoEntity.token = token;
  }
  final int? ttl = jsonConvert.convert<int>(json['ttl']);
  if (ttl != null) {
    loginInfoEntity.ttl = ttl;
  }
  final int? expires = jsonConvert.convert<int>(json['expires']);
  if (expires != null) {
    loginInfoEntity.expires = expires;
  }
  return loginInfoEntity;
}

Map<String, dynamic> $LoginInfoEntityToJson(LoginInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['uid'] = entity.uid;
  data['token'] = entity.token;
  data['ttl'] = entity.ttl;
  data['expires'] = entity.expires;
  return data;
}

extension LoginInfoEntityExtension on LoginInfoEntity {
  LoginInfoEntity copyWith({
    String? uid,
    String? token,
    int? ttl,
    int? expires,
  }) {
    return LoginInfoEntity()
      ..uid = uid ?? this.uid
      ..token = token ?? this.token
      ..ttl = ttl ?? this.ttl
      ..expires = expires ?? this.expires;
  }
}